home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Utilities / Winter Shell 1.0d2 / Source / Libraries / LowMemLib / LowMemLib.c next >
Encoding:
C/C++ Source or Header  |  1993-12-20  |  4.4 KB  |  204 lines  |  [TEXT/KAHL]

  1. /* Functions for getting and setting low-memory globals. These functions
  2.     ensure compatability between the MPW and THINK C compilers, as well
  3.     as removing direct references to global variables from the code
  4.     (eliminating low-memory globals is recommended by Apple).
  5.     
  6.     93/12/20 aih - removed unneeded globals
  7.     93/12/16 aih - added GetSysFontSize
  8.     93/12/07 aih - added SetAtMenuBottom
  9.     93/12/02 aih - added SetTopMenuItem
  10.     93/11/15 aih - added functions to get and set SEvtEnb
  11.     93/10/15 aih - added GetCurDirStore
  12.     93/03/12 aih - added segment loader globals
  13.     93/03/16 aih - added functions to get CurActivate and CurDeactivate
  14.     91/11/15 aih - created library */
  15.  
  16. #include <SysEqu.h>
  17. #include "LowMemLib.h"
  18.  
  19. /* low-memory globals not defined in SysEqu.h */
  20. enum {
  21.     ANumber = 0x0A98,
  22.     DABeeper = 0x0A9C,
  23.     HWCfgFlags = 0x0B22,
  24.     FSFCBLen = 0x03F6,
  25.     TopMenuItem = 0xA0A,
  26.     AtMenuBottom = 0xA0C,
  27.     MenuList = 0x0A1C
  28. };
  29.  
  30. /*----------------------------------------------------------------------------*/
  31. /* dialog manager */
  32. /*----------------------------------------------------------------------------*/
  33.  
  34. DABeeperProcPtr GetDABeeper(void)
  35. {
  36.     return(*(DABeeperProcPtr *) DABeeper);
  37. }
  38.  
  39. short GetANumber(void)
  40. {
  41.     return(*(short *) ANumber);
  42. }
  43.  
  44. /*----------------------------------------------------------------------------*/
  45. /* file manager */
  46. /*----------------------------------------------------------------------------*/
  47.  
  48. short GetHWCfgFlags(void)
  49. {
  50.     return(*(short *) HWCfgFlags);
  51. }
  52.  
  53. short GetFSFCBLen(void)
  54. {
  55.     return(*(short *) FSFCBLen);
  56. }
  57.  
  58. /*----------------------------------------------------------------------------*/
  59. /* memory manager */
  60. /*----------------------------------------------------------------------------*/
  61.  
  62. Ptr GetROMBase(void)
  63. {
  64.     return(*(Ptr *) ROMBase);
  65. }
  66.  
  67. Ptr GetHeapEnd(void)
  68. {
  69.     return(*(Ptr *) HeapEnd);
  70. }
  71.  
  72. Ptr GetCurStackBase(void)
  73. {
  74.     return(*(Ptr *) CurStackBase);
  75. }
  76.  
  77. /*----------------------------------------------------------------------------*/
  78. /* menu manager */
  79. /*----------------------------------------------------------------------------*/
  80.  
  81. Handle GetMenuList(void)
  82. {
  83.     return(*(Handle *) MenuList);
  84. }
  85.  
  86. void SetTopMenuItem(short top)
  87. {
  88.     *(short *) TopMenuItem = top;
  89. }
  90.  
  91. void SetAtMenuBottom(short bottom)
  92. {
  93.     *(short *) AtMenuBottom = bottom;
  94. }
  95.  
  96. /*----------------------------------------------------------------------------*/
  97. /* resource manager */
  98. /*----------------------------------------------------------------------------*/
  99.  
  100. Boolean GetResLoad(void)
  101. {
  102.     return(*(Boolean *)ResLoad);
  103. }
  104.  
  105. /*----------------------------------------------------------------------------*/
  106. /* scrap manager */
  107. /*----------------------------------------------------------------------------*/
  108.  
  109. Size GetScrapCount(void)
  110. {
  111.     return(*(short *) ScrapCount);
  112. }
  113.  
  114. /*----------------------------------------------------------------------------*/
  115. /* standard file package */
  116. /*----------------------------------------------------------------------------*/
  117.  
  118. long GetCurDirStore(void)
  119. {
  120.     return(*(long *) CurDirStore);
  121. }
  122.  
  123. void SetCurDirStore(long dir)
  124. {
  125.     *(long *) CurDirStore = dir;
  126. }
  127.  
  128. void SetSFSaveDisk(short vol)
  129. {
  130.     *(short *) SFSaveDisk = vol;
  131. }
  132.  
  133. short GetSFSaveDisk(void)
  134. {
  135.     return(*(short *) SFSaveDisk);
  136. }
  137.  
  138. /*----------------------------------------------------------------------------*/
  139. /* window manager */
  140. /*----------------------------------------------------------------------------*/
  141.  
  142. WindowPtr GetWindowList(void)
  143. {
  144.     return(*(WindowPtr *) WindowList);
  145. }
  146.  
  147. void SetDeskHook(ProcPtr hook)
  148. {
  149.     *(ProcPtr *) DeskHook = hook;
  150. }
  151.  
  152. void SetDragHook(ProcPtr hook)
  153. {
  154.     *(ProcPtr *) DragHook = hook;
  155. }
  156.  
  157. WindowPtr GetCurActivate(void)
  158. {
  159.     return(*(WindowPtr *) CurActivate);
  160. }
  161.  
  162. WindowPtr GetCurDeactive(void)
  163. {
  164.     return(*(WindowPtr *) CurDeactive);
  165. }
  166.  
  167. void SetCurActivate(WindowPtr window)
  168. {
  169.     *(WindowPtr *) CurActivate = window;
  170. }
  171.  
  172. void SetCurDeactive(WindowPtr window)
  173. {
  174.     *(WindowPtr *) CurDeactive = window;
  175. }
  176.  
  177. /*----------------------------------------------------------------------------*/
  178. /* segment loader */
  179. /*----------------------------------------------------------------------------*/
  180.  
  181. short GetCurJTOffset(void)
  182. {
  183.     return(*(short *) CurJTOffset);
  184. }
  185.  
  186. void SetSegHiEnable(Boolean enable)
  187. {
  188.     *(Byte *) SegHiEnable = enable;
  189. }
  190.  
  191. Boolean GetSegHiEnable(void)
  192. {
  193.     return(*(Byte *) SegHiEnable);
  194. }
  195.  
  196. /*----------------------------------------------------------------------------*/
  197. /* miscelaneous */
  198. /*----------------------------------------------------------------------------*/
  199.  
  200. Ptr GetCurrentA5(void)
  201. {
  202.     return(*(Ptr *) CurrentA5);
  203. }
  204.